/**
 * @author Tony
 * @date 2018-01-10
 * @project rest_demo
 */
package com.sms.web;

import com.sms.client.selfcli.AbsRestClient;
import com.sms.client.selfcli.JsonReqClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 验证码的服务模块
 */
@RestController
@RequestMapping("yzm")
public class RestTestController {

	@Autowired
	RedisTemplate<String,String> redisTemplate;



	static AbsRestClient InstantiationRestAPI() {
		return new JsonReqClient();
	}
	
	
	/**
	 * 参数名称含义，请参考rest api 文档
	 * @throws
	 * @method
	 */
	@RequestMapping("/sendmsg")
	public String getCode(String phone,String code){
		String sms = InstantiationRestAPI().sendSms("187e29ebb9b2f295f3c8495e7edebc97", "110a74b969040530c701fea29c1bbc25",
				"a5aa96301b034726905acfc090237e3e",
				"565601", code,
				phone, "zhangsan1");


		redisTemplate.opsForValue().set("code",code);
		return sms;

	}



}
